package com.zb.service.impl;

import com.zb.dao.ManagerMapper;
import com.zb.model.*;
import com.zb.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ManagerServiceImpl implements ManagerService{

	@Autowired
	private ManagerMapper mm;
	
	public int userSumCount() {
		return mm.userCount().size();
	}
	
	public List<TUser> userList() {
		return mm.userList();
	}
	
	public void delUserByUserId(String userId) {
		System.out.println(userId);
		mm.delUserByUserId(userId);
	}

	@Override
	public void addUser(TUser user) {
		mm.addUser(user);
	}

	@Override
	public void reUser(TUser user) {
		mm.reUser(user);
	}
	
	public List<TGoods> selectAllGoodsInDB() {
		return mm.goodsList();
	}

	@Override
	public void addGoods(TGoods goods) {
		mm.addGoods(goods);
		
	}

	@Override
	public void reGoods(TGoods goods) {
		mm.reGoods(goods);
		
	}
	
	@Override
	public void reStock(TGoods goods) {
		mm.reStock(goods);
	}

	@Override
	public void deleteGoods(String goodsid) {
		mm.deleteGoods(goodsid);
		
	}

	@Override
	public void deleteOrder(String orderid) {
		mm.deleteOrder(orderid);
		
	}

	@Override
	public TAdmin selectAdmin(String username, String password) {
		return mm.selectAdmin(username,password);
	}

	@Override
	public List<TOrder> orderList() {
		
		return mm.orderList();
	}
	
	@Override
	public List<TUser> dimSelectService(String users_dimSearch) {
		users_dimSearch="%"+users_dimSearch+"%";
		return mm.dimSelect(users_dimSearch);
	}

	@Override
	public List<TCategory> dimCateSelectService(String cates_dimSearch) {
		cates_dimSearch="%"+cates_dimSearch+"%";
		return mm.dimCateSelect(cates_dimSearch);
	}
	
	@Override
	public List<TOrder> dimOrderSelectService(String orders_dimSearch) {
		orders_dimSearch="%"+orders_dimSearch+"%";
		return mm.dimOrderSelect(orders_dimSearch);
	}

	@Override
	public List<TOrder> findOrdersService() {
		return mm.findOrdersService();
	}
	
}
	
	
